Optimal. Leaf size=62 \[ \frac {\cos (a+x (b-2 d)-2 c)}{4 (b-2 d)}+\frac {\cos (a+x (b+2 d)+2 c)}{4 (b+2 d)}-\frac {\cos (a+b x)}{2 b} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.05, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 2, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {4569, 2638} \[ \frac {\cos (a+x (b-2 d)-2 c)}{4 (b-2 d)}+\frac {\cos (a+x (b+2 d)+2 c)}{4 (b+2 d)}-\frac {\cos (a+b x)}{2 b} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2638
Rule 4569
Rubi steps
\begin {align*} \int \sin (a+b x) \sin ^2(c+d x) \, dx &=\int \left (\frac {1}{2} \sin (a+b x)-\frac {1}{4} \sin (a-2 c+(b-2 d) x)-\frac {1}{4} \sin (a+2 c+(b+2 d) x)\right ) \, dx\\ &=-\left (\frac {1}{4} \int \sin (a-2 c+(b-2 d) x) \, dx\right )-\frac {1}{4} \int \sin (a+2 c+(b+2 d) x) \, dx+\frac {1}{2} \int \sin (a+b x) \, dx\\ &=-\frac {\cos (a+b x)}{2 b}+\frac {\cos (a-2 c+(b-2 d) x)}{4 (b-2 d)}+\frac {\cos (a+2 c+(b+2 d) x)}{4 (b+2 d)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.71, size = 69, normalized size = 1.11 \[ \frac {1}{4} \left (\frac {\cos (a+b x-2 c-2 d x)}{b-2 d}+\frac {\cos (a+b x+2 c+2 d x)}{b+2 d}+\frac {2 \sin (a) \sin (b x)}{b}-\frac {2 \cos (a) \cos (b x)}{b}\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.43, size = 71, normalized size = 1.15 \[ \frac {b^{2} \cos \left (b x + a\right ) \cos \left (d x + c\right )^{2} + 2 \, b d \cos \left (d x + c\right ) \sin \left (b x + a\right ) \sin \left (d x + c\right ) - {\left (b^{2} - 2 \, d^{2}\right )} \cos \left (b x + a\right )}{b^{3} - 4 \, b d^{2}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.19, size = 56, normalized size = 0.90 \[ \frac {\cos \left (b x + 2 \, d x + a + 2 \, c\right )}{4 \, {\left (b + 2 \, d\right )}} + \frac {\cos \left (b x - 2 \, d x + a - 2 \, c\right )}{4 \, {\left (b - 2 \, d\right )}} - \frac {\cos \left (b x + a\right )}{2 \, b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.20, size = 57, normalized size = 0.92 \[ -\frac {\cos \left (b x +a \right )}{2 b}+\frac {\cos \left (a -2 c +\left (b -2 d \right ) x \right )}{4 b -8 d}+\frac {\cos \left (a +2 c +\left (b +2 d \right ) x \right )}{4 b +8 d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 0.35, size = 414, normalized size = 6.68 \[ \frac {{\left (b^{2} \cos \left (2 \, c\right ) - 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left ({\left (b + 2 \, d\right )} x + a + 4 \, c\right ) + {\left (b^{2} \cos \left (2 \, c\right ) - 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left ({\left (b + 2 \, d\right )} x + a\right ) + {\left (b^{2} \cos \left (2 \, c\right ) + 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left (-{\left (b - 2 \, d\right )} x - a + 4 \, c\right ) + {\left (b^{2} \cos \left (2 \, c\right ) + 2 \, b d \cos \left (2 \, c\right )\right )} \cos \left (-{\left (b - 2 \, d\right )} x - a\right ) - 2 \, {\left (b^{2} \cos \left (2 \, c\right ) - 4 \, d^{2} \cos \left (2 \, c\right )\right )} \cos \left (b x + a + 2 \, c\right ) - 2 \, {\left (b^{2} \cos \left (2 \, c\right ) - 4 \, d^{2} \cos \left (2 \, c\right )\right )} \cos \left (b x + a - 2 \, c\right ) + {\left (b^{2} \sin \left (2 \, c\right ) - 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left ({\left (b + 2 \, d\right )} x + a + 4 \, c\right ) - {\left (b^{2} \sin \left (2 \, c\right ) - 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left ({\left (b + 2 \, d\right )} x + a\right ) + {\left (b^{2} \sin \left (2 \, c\right ) + 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left (-{\left (b - 2 \, d\right )} x - a + 4 \, c\right ) - {\left (b^{2} \sin \left (2 \, c\right ) + 2 \, b d \sin \left (2 \, c\right )\right )} \sin \left (-{\left (b - 2 \, d\right )} x - a\right ) - 2 \, {\left (b^{2} \sin \left (2 \, c\right ) - 4 \, d^{2} \sin \left (2 \, c\right )\right )} \sin \left (b x + a + 2 \, c\right ) + 2 \, {\left (b^{2} \sin \left (2 \, c\right ) - 4 \, d^{2} \sin \left (2 \, c\right )\right )} \sin \left (b x + a - 2 \, c\right )}{8 \, {\left (b^{3} \cos \left (2 \, c\right )^{2} + b^{3} \sin \left (2 \, c\right )^{2} - 4 \, {\left (b \cos \left (2 \, c\right )^{2} + b \sin \left (2 \, c\right )^{2}\right )} d^{2}\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.74, size = 98, normalized size = 1.58 \[ -\frac {d\,\left (2\,b\,\cos \left (a-2\,c+b\,x-2\,d\,x\right )-2\,b\,\cos \left (a+2\,c+b\,x+2\,d\,x\right )\right )+b^2\,\cos \left (a-2\,c+b\,x-2\,d\,x\right )+b^2\,\cos \left (a+2\,c+b\,x+2\,d\,x\right )}{16\,b\,d^2-4\,b^3}-\frac {\cos \left (a+b\,x\right )}{2\,b} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 6.70, size = 408, normalized size = 6.58 \[ \begin {cases} x \sin {\relax (a )} \sin ^{2}{\relax (c )} & \text {for}\: b = 0 \wedge d = 0 \\\left (\frac {x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {x \cos ^{2}{\left (c + d x \right )}}{2} - \frac {\sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d}\right ) \sin {\relax (a )} & \text {for}\: b = 0 \\\frac {x \sin {\left (a - 2 d x \right )} \sin ^{2}{\left (c + d x \right )}}{4} - \frac {x \sin {\left (a - 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} - \frac {x \sin {\left (c + d x \right )} \cos {\left (a - 2 d x \right )} \cos {\left (c + d x \right )}}{2} - \frac {3 \sin {\left (a - 2 d x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 d} + \frac {\cos {\left (a - 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: b = - 2 d \\\frac {x \sin {\left (a + 2 d x \right )} \sin ^{2}{\left (c + d x \right )}}{4} - \frac {x \sin {\left (a + 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {x \sin {\left (c + d x \right )} \cos {\left (a + 2 d x \right )} \cos {\left (c + d x \right )}}{2} - \frac {3 \sin {\left (a + 2 d x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 d} - \frac {\cos {\left (a + 2 d x \right )} \cos ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: b = 2 d \\- \frac {b^{2} \sin ^{2}{\left (c + d x \right )} \cos {\left (a + b x \right )}}{b^{3} - 4 b d^{2}} + \frac {2 b d \sin {\left (a + b x \right )} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{b^{3} - 4 b d^{2}} + \frac {2 d^{2} \sin ^{2}{\left (c + d x \right )} \cos {\left (a + b x \right )}}{b^{3} - 4 b d^{2}} + \frac {2 d^{2} \cos {\left (a + b x \right )} \cos ^{2}{\left (c + d x \right )}}{b^{3} - 4 b d^{2}} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________